# -*- coding:utf-8 -*-
__author__ = 'Serprutiy'

import threading
import time


def context(tJoin):
    print(threading.currentThread().getName())
    print('In threadContext.')
    tJoin.start()

    tJoin.join()

    print('Out threadContext.')


def join():
    print(threading.currentThread().getName())
    print('In threadJoin.')
    time.sleep(1)
    print('Out threadJoin.')


def test_join():
    tJoin = threading.Thread(target=join)
    tContext = threading.Thread(target=context, args=(tJoin,))

    print(threading.currentThread().getName())
    print('thread main.')

    tContext.start()


if __name__ == '__main__':
    test_join()
